package com.diandi.java.ai.langchain4j.controller;

import com.diandi.java.ai.langchain4j.assistant.XiaozanAgent;
import com.diandi.java.ai.langchain4j.bean.ChatForm;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Flux;

/**
 * @Classname XiaozanController
 * @Description TODO
 * @Date 2025/4/25 00:46
 * @Created by shizan
 */
@Tag(name = "智慧小赞")
@RestController
@RequestMapping("/xiaozhi")
public class XiaozanController {

    @Autowired
    private XiaozanAgent xiaozanAgent;
    @Operation(summary = "对话")
    @PostMapping("/chat")
    public Flux<String> chat(@RequestBody ChatForm chatForm) {
        return xiaozanAgent.chat(chatForm.getMemoryId(), chatForm.getMessage());
    }
}
